#pragma once
#include <assert.h>
#include "MyLog.h"

#define assertArrayEquals(expecteds, actuals, size)                            \
    do                                                                         \
    {                                                                          \
        for (int i = 0; i < (size); i++)                                       \
        {                                                                      \
            if ((expecteds)[i] != (actuals)[i])                                \
            {                                                                  \
                myErrorLog();                                                  \
                printf("expecteds[%d]!=actuals[%d], expected=%d, actual=%d\n", \
                       i, i, (expecteds)[i], (actuals)[i]);                    \
                assert((expecteds)[i] == (actuals)[i]);                        \
            }                                                                  \
        }                                                                      \
    } while (0)

#define assertEquals(expected, actual)                                  \
    do                                                                  \
    {                                                                   \
        if ((expected) != (actual))                                     \
        {                                                               \
            myErrorLog();                                               \
            printf("expected: %d, actual: %d\n", (expected), (actual)); \
            assert((expected) == (actual));                             \
        }                                                               \
    } while (0)

#define assertTrue(condition)                         \
    do                                                \
    {                                                 \
        if ((condition) == 0)                         \
        {                                             \
            myErrorLog();                             \
            printf("%d is not true!\n", (condition)); \
            assert((condition) != 0);                 \
        }                                             \
    } while (0)

#define assertFalse(condition)                         \
    do                                                 \
    {                                                  \
        if ((condition) != 0)                          \
        {                                              \
            myErrorLog();                              \
            printf("%d is not false!\n", (condition)); \
            assert((condition) == 0);                  \
        }                                              \
    } while (0)
